/**
@file

@brief

@author
	GengYong
@revision
	2005/11/05 * Created by GengYong.
*/


#ifndef SAF_HEADER_FILE_HELPERTOOLS_H
#define SAF_HEADER_FILE_HELPERTOOLS_H

#include "KernelExport.h"

namespace SAF
{
	inline const char * GetConnectionNodeIP(IConnection * node)
	{
		if(node != NULL)
		{
			return ((const char *)(node->Restore("#IP#", NULL)));
		}
		return NULL;
	}

	inline unsigned short GetConnectionNodePort(IConnection * node)
	{
		if (node != NULL)
		{
			unsigned long size = 0;
			void * buf = node->Restore("#PORT#", &size);
			if (buf != NULL && size == sizeof(unsigned short))
			{
				return *(unsigned short*)buf;
			}
		}
		return 0;
	}
}

#endif	//#ifndef SAF_HEADER_FILE_HELPERTOOLS_H
